<?php

$dtabase_str = file_get_contents('../database.sql');
preg_match_all('/DROP TABLE IF EXISTS `ahsmp_(.*?)`;/i', $dtabase_str, $arr);

foreach ($arr[1] as $v)
{
    $nv = str_replace(' ', '', ucwords(str_replace('_', ' ', $v)));
    $servicePath = '../application/common/service/';
    file_exists($servicePath . $nv . '.php') ? : file_put_contents($servicePath . $nv . '.php', "<?php\n\nnamespace app\common\service;\n\n\nclass $nv extends Base \n\n{\n\n}");
    $modelPath = '../application/common/model/';
    file_exists($modelPath . $nv . '.php') ? : file_put_contents($modelPath . $nv . '.php', "<?php\n\nnamespace app\common\model;\n\nuse think\Model;\nclass $nv extends Model \n\n{\n\n}");
}